var wtt;
function wishlist_get_item(){
	search=document.getElementById('wishlist_search').value;
	if(isNaN(search)||(search=='')){
		$('#wishlist_items_list').html("<div style='text-align: center; padding-top: 30px;'>Recherche...</div>");
		$.post(
			"ajaxload.php",
			{ page: 'modules/wishlist/ajax.php', action: 'recherche', str: search},
			function(data){
				//alert(data);
				$('#wishlist_items_list').html(data);
				$('#wishlist_items_list .wishlist_item_container').click(function(){
					$('#wishlist_items_list .item_selection').removeClass("item_selection");
					$(this).addClass("item_selection");
					$('#wishlist_item_data').html("Recherche...");
					$.post(
						"ajaxload.php",
						{ page: 'modules/wishlist/admin/ajax.php', action: 'data', id: $(this).attr('id')},
						function(data){
							$('#wishlist_item_data').html(data);
						}
					);
				}).addClass('pointer');
			}
		);
	}
}

function wishlist_attribuer(idItem,idPlayer){
	open_dialog(
		'Attribuer un objet',
		'Voulez-vous attribuer cet objet a ce joueur?',
		{ "Oui": function(){
				$.post(
					"ajaxload.php",
					{ page: 'modules/wishlist/admin/ajax.php', action: 'attribuer', id: idItem, idPlayer: idPlayer},
					function(data){
						$('#wishlist_item_data').html(data);
					}
				);
				$(this).dialog('close');
			},
		"Non": function(){ $(this).dialog('close'); }
		}
	);
}

function wishlist_enlever(idItem,idPlayer){
	open_dialog(
		'Enlever un objet',
		'Voulez-vous enlever cet objet a ce joueur?',
		{ "Oui": function(){
				$.post(
					"ajaxload.php",
					{ page: 'modules/wishlist/admin/ajax.php', action: 'enlever', id: idItem, idPlayer: idPlayer},
					function(data){
						$('#wishlist_item_data').html(data);
					}
				);
				$(this).dialog('close');
			},
		"Non": function(){ $(this).dialog('close'); }
		}
	);
}